from langchain.prompts import PromptTemplate
import os

from langchain_core.prompts import FewShotPromptTemplate

os.environ["DASHSCOPE_API_KEY"]= "sk-9d8f1914800e497f8717144e860f99bc"

examples = [
    {
        "question":"你好吗?",
        "answer":"帅哥，我很好"
     },
     {
        "question":"今天周几?",
        "answer":"帅哥，今天周二"
     },
     {
        "question":"天气好吗?",
        "answer":"帅哥，是的，今天天谴确实不错"
     }
]

example_prompt = PromptTemplate(input_variables = ["question","answer"], template="Question: {question}\n{answer}")
few_shot_prompt = prompt = FewShotPromptTemplate(
    examples=examples,
    example_prompt=example_prompt,
    suffix="Question: {input}",
    input_variables=["input"]
)

print(few_shot_prompt.format(input = "你叫什么名字"))
#
# llm = Tongyi()
# llm.predict(prompt.format(input="我怎么这么丑"))